package com.lykj.lib_base.adapter.viewpager

import android.view.View
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.PagerAdapter

/**
 * @author gosha
 * @date 2022/3/3-9:19 上午
 * description：viewPager适配器
 */
class FragmentSPAdapter(fm: FragmentManager, fragments: ArrayList<Fragment>) :
    FragmentStatePagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
    private var mFragments: ArrayList<Fragment> = fragments


    override fun getCount(): Int {
        return mFragments.size
    }

    override fun getItem(position: Int): Fragment {
        return mFragments[position]
    }
}